package com.iprojectmanager.views;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
//import javax.servlet.http.HttpServlet;
import javax.servlet.http.*;
import com.iprojectmanager.entities.*;

/**
 * @author Trejo Sandoval Sergio Alberto
 */
public class VistaUsuario extends Vista
{

    //Metodo para la vista principal
    public void mainView(PrintWriter out,HttpServletRequest request)
    throws ServletException, IOException 
    {
        HttpSession session = request.getSession();
        IntegranteProyecto user = (IntegranteProyecto)session.getAttribute("user");
        
        out.println(Utilities.getDocType());
        out.println("<HTML>" + Utilities.getHead("Integrante de Proyecto"));
        out.println("<div id=\"container\">");
        out.println(Utilities.getIntro("Integrante del Proyecto : " + user.getProyecto().getNombre(),user));
        
        String form = 
        	"<div id=\"pageContent\">"+
                        "<div id=\"selection1\">" + this.getFormIntegrante() + "</div>" +
                        Utilities.getFooter() + 
                "</div>";
        
        out.println(form);
        out.println(Utilities.getMenu());
        out.println("</div> <!-- fin container---></BODY></HTML>");
        
    }

    //Metodo para la vista en caso de errores
    @Override
    public void operationResult(PrintWriter out) throws ServletException, IOException
    {
    } 

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        PrintWriter out = response.getWriter();
            response.setContentType("text/html");
            mainView(out,request);
    }

    @Override
    public String getServletInfo() {
        return "Vista del Administrador";
    }
    
    public String getFormIntegrante()
    {
        return 
        	"<h3><span>Tareas</span></h3>"+
		"<p class=\"p1\"><span>"+
                    "<form action=\"DeveloperControl\" method=\"GET\">"+
                        "<label>ACCIONES:</label>"+
			"<select name=\"operacionesintegrante\">"+
                            "<option>Listar Actividades</option>"+
                            "<option>Enviar Avance</option>"+
			"</select><br></br>"+
			"<button type=\"submit\">Aceptar</button>"+
                    "</form>"+
		"</span></p>";
    }
}

